/*
 * @Author: your name
 * @Date: 2020-10-25 23:57:53
 * @LastEditTime: 2020-10-29 19:10:32
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \就业班练习d:\桌面\ma-pc\src\api\user.js
 */
import axios from '@/utils/request'
// 登录
export const login = (mobile, code) => {
  // 返回一个登录的axios请求
  return axios({
    url: 'mp/v1_0/authorizations',
    method: 'POST',
    data: {
      mobile,
      code
    }
  })
}
// 获取用户信息
export const getInfo = () => {
  return axios({
    url: 'mp/v1_0/user/profile',
    method: 'GET'
  })
}

/**
 * @description: 修改头像
 * @param {*} formData 更新的头像
 * @return {Promise}
 */
export const upAvatar = (formData) => {
  return axios({
    url: 'mp/v1_0/user/photo',
    method: 'PATCH',
    data: formData
  })
}

/**
 * @description:
 * @param {String} name
 * @param {String} intro
 * @param {String} email
 * @return {Promise}
 */
export const upInfo = (name, intro, email) => {
  return axios({
    url: 'mp/v1_0/user/profile',
    method: 'PATCH',
    data: {
      name,
      intro,
      email
    }
  })
}
